VCCD_MAJOR 		= 1
VCCD_MINOR 		= 1
VCCD_PATCH 		= 1
VCCD_STR 		= -beta 

VCCD_COMPILE_TIME 	= $(shell date)
VCCD_COMPILE_BY 	= $(shell whoami)
VCCD_SYMVER 		= vcc $(VCCD_MAJOR).$(VCCD_MINOR).$(VCCD_PATCH)$(VCCD_STR)

srcs 			= main.c vcc.c pretty.c cmd.c 
objs 			= main.o vcc.o pretty.o cmd.o 
target 			= vcc 
CFLAGS 			= -Wall -Werror -Iinclude -g 
MAKEFLAGS 		= --no-print-directory

VCCD_VERSION 		= vccd $(VCCD_MAJOR).$(VCCD_MINOR).$(VCCD_PATCH) \
		  $(VCCD_COMPILE_TIME) $(VCCD_COMPILE_BY)

all : 
	@echo "$(VCCD_VERSION)"
	@echo "$(VCCD_SYMVER)"
	@echo "#define VCCD_VERSION \"$(VCCD_VERSION)\"" > include/vcc/version.h 
	@echo "#define VCCD_SYMVER \"$(VCCD_SYMVER)\"" >> include/vcc/version.h 
	@$(MAKE) $(target) $(MAKEFLAGS)

$(target) : 	$(objs) $(srcs)
	@$(CC) $(CFLAGS) $(objs) -o $(target)
	@echo -e "LD\t\t\t$(target)"

%.o : %.c
	@$(CC) -c $(CFLAGS) $*.c 
	@echo -e "CC\t\t\t$*.c"

.PHONY clean : 
	$(RM) $(objs) $(target) -f  

